﻿<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="jQueryTest.aspx.vb" Inherits="WebPhonebook.jQueryTest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
     <script src ="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
     <%--<script type="text/javascript">
         function setURL() {
             document.getElementById('ref').href = "http://localhost:60213/test.aspx";
         }
     </script>--%>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <br />
        <br />
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        <br />
        <br />
        <asp:CheckBox ID="CheckBox1" runat="server" />
        <br />
        <asp:DropDownList ID="DropDownList1" runat="server">
            <asp:ListItem Value="first"></asp:ListItem>
            <asp:ListItem Value="second"></asp:ListItem>
            <asp:ListItem Value="third"></asp:ListItem>
        </asp:DropDownList>

        <br />
        <br />
        <asp:HiddenField ID="HiddenField1" runat="server" />
        <br />
        <br />
        <br />
        <a id="ref" href="http://www.google.com" onclick="return confirm('Changed')">Google</a>
        
    </div>
    </form>

   
    <script type="text/javascript">

        $("input:text").each(function () {

            $(this).change(function () {
                // flag = 1;
                // if (flag)
                // alert("value changed!");

                //document.getElementById('HiddenField1').value = "True";
                document.getElementById('ref').onclick = "return confirm('Changed')";
                //                  $('#ref').bind('click', function () {
                //                      return confirm("changed!");
                //                  });

            });
        });

          $("input:checkbox").each(function () {

              $(this).change(function () {
//                  flag = 1;
//                  if (flag)
//                      alert("value changed!");
                  document.getElementById('HiddenField1').value = "True";
//                  $('#ref').bind('click', function () {
//                      return confirm("changed!");
//                  });
                  
              });
          });

          $("select").each(function () {

              $(this).change(function () {

                  document.getElementById('HiddenField1').value = "True";
                  
//                  $('#ref').bind('click', function () {
//                      return confirm("changed!");
//                  });
                  
              });
          });

          function leavePage(){
          if(domument.getElementById('HiddenField1').value == "True")
          return confirm("changed!");
          
          }        
    </script>


</body>
</html>
